// Your app's root module...
var sentenceMgmtModule = angular.module('sentenceMgmtModule', []);


sentenceMgmtModule.controller('HMSIntelligenceCtrl',
  function HMSIntelligenceCtrl($scope, $http)
  {
     $scope.addPatient = function (){

        //alert("Patient @ line 10");
    		//alert("Patient - " + $scope.Patient);
        console.log("Patient (JSON) before is ============> " + $scope.Patient);
        var patientJSON = angular.toJson($scope.Patient);
        console.log("Patient (JSON) after is ============> " + patientJSON);

        //alert(JSON.stringify($scope.Patient).replace(',','\n'));

        //$http.post('/HMS_Web/services/ManagePatient/AddPatient',$scope.Patient);
        $http({
          method: 'POST',
          data: $scope.Patient,
          url:'/HMS_Web/services/ManagePatient/AddPatient',
          headers: {'Content-Type':'application/json'}
        });
    };
  }
);

function attachTabEvent()
{
	var myInput = this.id;
	console.log("this.id ---> " + this.id); 
	//document.getElementById(txtBox);
	if(myInput.addEventListener ) {
	    myInput.addEventListener('keydown',this.keyHandler,false);
	} else if(myInput.attachEvent ) {
	    myInput.attachEvent('onkeydown',this.keyHandler); /* damn IE hack */
	}
}

function keyHandler(e) {
    var TABKEY = 9;
    if(e.keyCode == TABKEY) {
        this.value += "   sarat ";
        if(e.preventDefault) {
            e.preventDefault();
        }
        return false;
    }
}